
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2481. -- Pku3164 Command Network -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2481: Pku3164 Command Network</h2><span class=green>Time Limit: </span>30 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>29&nbsp;&nbsp;<span class=green>Solved: </span>3<br>[<a href='submitpage.php?id=2481'>Submit</a>][<a href='problemstatus.php?id=2481'>Status</a>][<a href='bbs.php?id=2481'>Discuss</a>]</center><h2>Description</h2><div class=content><div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; MST</span><span style="font-size: 12pt">（最小生成树）：对于无向带权图&lt;V，E&gt;，若其导出子图的边权和最小，且原图V中对应的任意两个顶点间有且仅有一条通路，则称此图为原图的MST。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">你的任务很简单，对于给定的有向带权图，求出其&ldquo;最小生成树&rdquo;，即指定一个根以后，每个点都是从根出发可达的。</span></div>
<div>&nbsp;</div></div><h2>Input</h2><div class=content><div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">输入文件最多包含3组测试数据，对于每组测试数据：</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">第一行为两个数n,m，表示有向带权图的顶点数和边数，点编号为1~n。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">接下来n行，每行两个整数X_i,Y_i，表示i个顶点在直角坐标系中的坐标。</span></div>
<div><span style="font-size: 12pt">&nbsp;&nbsp;&nbsp; </span><span style="font-size: 12pt">接下来m行，每行两个正整数x,y，表示存在一条由点x指向点y的有向边，边权为两顶点的曼哈顿距离（定义见下）。</span></div>
<div>&nbsp;</div></div><h2>Output</h2><div class=content><div style="text-indent: 21pt"><span style="font-size: 12pt">对于每组测试数据，输出一行：</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">如果不存在&ldquo;最小生成树&rdquo;，输出&ldquo;Poor&rdquo;；</span></div>
<div style="text-indent: 21pt"><span style="font-size: 12pt">否则输出最小边权和。</span></div>
<div>&nbsp;</div></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>    3 3<br />
    0 0<br />
    1 0<br />
    2 0<br />
    1 2<br />
    1 3<br />
    2 3<br />
    3 2<br />
    0 0<br />
    1 0<br />
    2 0<br />
    1 2<br />
    3 2<br />
 <br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>2<br />
Poor<br />
 <br />
</span></div><h2>HINT</h2>
			<div class=content><p><p>&nbsp;&nbsp;&nbsp; 100%的数据，n&le;1000，m&le;n*n，0&le;X_i,Y_i&le;10000。<br /><br />
&nbsp;&nbsp;&nbsp; 可能存在自环。<br /><br />
&nbsp;<br /><br />
【温馨提示】<br /><br />
对于两个点(a,b)，(c,d)，它们的曼哈顿距离定义如下：<br /><br />
l=|a-c|+|b-d|</p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search= 鸣谢 Hewr'> 鸣谢 Hewr</a></p></div><center>[<a href='submitpage.php?id=2481'>Submit</a>][<a href='problemstatus.php?id=2481'>Status</a>][<a href='bbs.php?id=2481'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
